//index.js

var Data = require("../../utils/data.js");

//获取应用实例
var app = getApp()
Page({
  data: {
    tips: '选择日期',
    date: '',
    tomorrow: '',
    userInfo: {}
  },
  //事件处理函数
  bindViewTap: function() {
    let that = this,
      startDate = that.data.date,
      endDate = that.data.tomorrow;
    wx.navigateTo({
      url: '../calender/index?startDate=' + startDate + "&endDate=" + endDate
    })
  },
  onShow: function() {
    let startDate = this.data.startDate,
      endDate = this.data.endDate,
      date = Data.formatDate(new Date(), "yyyy-MM-dd"),
      tomorrow1 = new Date();

    tomorrow1.setDate((new Date()).getDate() + 1);
    let tomorrow = Data.formatDate(new Date(tomorrow1), "yyyy-MM-dd");

    if (startDate == null) {
      startDate = date;
      endDate = tomorrow;
    }
    this.setData({
      date: startDate,
      tomorrow: endDate
    });
    console.log('当前日期是 ==>', startDate);
    console.log('默认选择的是 ==>', endDate);
  }
})